﻿/************************************************************************************
 * xujiajun@yoozoo.com 御剑
 * 隐藏指定显示元素的命令
 ***********************************************************************************/

using WorldMapBase.Tile;

namespace WorldMapBase.Display
{
    /// <summary>
    /// 隐藏指定显示元素的命令
    /// </summary>
    internal class HideCommand : DisplayCommand
    {
        protected override void OnExecute(DisplayElementFactory factory)
        {
            factory.DestroyDisplayElement(element);
            
#if UNITY_EDITOR
            TileDisplayManager.OnHideElement(GetResID());
#endif
        }

        protected internal override int GetResID()
        {
            return element.GetResID();
        }

        /// <summary>
        /// 设置隐藏命令需要的数据
        /// </summary>
        /// <param name="element">显示相关的元素</param>
        internal void SetData(IDisplayElement element)
        {
            this.element = element;
        }
    }

}

